<!DOCTYPE html>
            
<HTML>
<HEAD>
<meta name="booktitle" content="Developing Applications With Objective Caml" >
 <meta charset="ISO-8859-1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<META name="GENERATOR" content="hevea 1.05-7 of 2000-02-24">
<META NAME="Author" CONTENT="Christian.Queinnec@lip6.fr">
<LINK rel=stylesheet type="text/css" href="videoc-ocda.css">
<script language="JavaScript" src="videoc.js"><!--
//--></script>
<TITLE>
 Chapter Structure
</TITLE>
</HEAD>
<BODY class="regularBody">
<A HREF="book-ora103.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora105.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2>Chapter Structure</H2>This chapter introduces the tools of the Objective CAML distribution for
lexical analysis and parsing. The latter normally supposes that the
former has already taken place. In the first section, we introduce a
simple tool for lexical analysis provided by module <TT>Genlex</TT>. Next
we give details about the definition of sets of lexical units by
introducing the formalism of regular expressions. We illustrate
their behavior within module <TT>Str</TT> and the <TT>ocamllex</TT>
tool. In section two we define grammars and give details about sentence
production rules for a language to introduce two types of parsing:
bottom-up and top-down. They are further illustrated by using
<I>Stream</I> and the <TT>ocamlyacc</TT> tool. These examples
use context-free grammars. We then show how to carry out contextual
analysis with <I>Streams</I>. In the third section we go back to the
example of a BASIC interpreter from page <A HREF="book-ora058.html#sec-basic">??</A>, using
<TT>ocamllex</TT> and <TT>ocamlyacc</TT> to implement the lexical analysis
and parsing functions.<BR>
<BR>
<HR>
<A HREF="book-ora103.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora105.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
